package com.activiti.z_six.service.impl;

import com.activiti.z_six.entity.taskAssignee.SmsEntity;
import com.activiti.z_six.mapper.taskAssigneeMapper.SmsEntityMapper;
import com.activiti.z_six.service.ISmsEntityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class ISmsEntityServiceImpl implements ISmsEntityService {
    @Autowired
    private SmsEntityMapper smsEntityMapper;
    @Override
    public HashMap<String,Object> smsList(String toUser,Integer pageNum,Integer pagesize,String status){
        HashMap<String,Object> hashMap=new HashMap<>();
        List<SmsEntity> smsEntityList=smsEntityMapper.smsList(toUser,pageNum,pagesize,status);
        List<SmsEntity> smsEntities=smsEntityMapper.smsListNum(toUser,status);
        hashMap.put("list",smsEntityList);
        hashMap.put("total",smsEntities.size());
        return hashMap;
    }
    @Override
    public SmsEntity smsEntity(String id){
        SmsEntity smsEntity=smsEntityMapper.smsEntity(id);
        return smsEntity;
    }
    @Override
    public String addSms(SmsEntity smsEntity)
    {
        String msg="";
        try{
            smsEntityMapper.addSms(smsEntity);
            return "suess";
        }
        catch (Exception ex){
            return ex.getMessage();
        }
    }
    @Override
    public String updateState(String id){
        String msg="";
        try{
            smsEntityMapper.updateState(id);
            return "suess";
        }
        catch (Exception ex){
            return ex.getMessage();
        }
    }
    @Override
    public String deleteSms(String id){
        String msg="";
        try{
            smsEntityMapper.deleteSms(id);
            return "suess";
        }
        catch (Exception ex){
            return ex.getMessage();
        }
    }

}
